hook::add incoming_invite join_by_invite
proc join_by_invite {xlib from to body} {
disco::request_info $xlib [::xmpp::jid::server $to] \
	-cache yes \
	-command [list join_by_invite1 $xlib $to]
}

proc join_by_invite1 {xlib group res identities features extras} {
	global bot
    if {[string equal $res ok] && [lsearch -exact $features $::NS(muc)] >= 0} {
		muc::join_group $xlib $group $bot(nick)
	return
    }

}